home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / suckmods.zip / SUCK05 / HELPERS / CHARSTOQ.C < prev   
C/C++ Source or Header  |  1997-05-09  |  529b  |  28 lines

  1. #include <stdio.h>
  2. int main(int argc, char ** argv)
  3. {
  4.   unsigned char s[1024];
  5.   short sh;
  6.   int i=0;
  7.   int inverse=0;
  8.  
  9.   if (argc>=2) inverse=1;
  10.   
  11.   printf("Enter a string to compile: "); fflush(stdout);
  12.   
  13.   gets(s);
  14.  
  15.   while (i<strlen(s))
  16.     {
  17.       if (inverse) { if (isalpha(s[i])) s[i]+=128;
  18.              if (isalpha(s[i+1])) s[i+1]+=128; }
  19.       sh=s[i];
  20.       sh|=s[i+1]<<8;
  21.       if ((i+1)==strlen(s))
  22.     printf("\tWriteByte(MSG_ONE, %d);\n", sh&0xff);
  23.       else
  24.     printf("\tWriteShort(MSG_ONE, %d);\n", sh);
  25.       i+=2;
  26.     }
  27. }
  28.